package com.xuan.webfinally.mapper;

import com.xuan.webfinally.entity.SlopeInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xuan.webfinally.entity.clickDTO;
import com.xuan.webfinally.entity.leida;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 边坡信息表 Mapper 接口
 * </p>
 *
 * @author gyuxuan
 * @since 2025-05-18
 */
@Mapper
public interface SlopeInfoMapper extends BaseMapper<SlopeInfo> {

    @Select("SELECT * FROM slope_info ORDER BY id DESC LIMIT #{limit}")
    List<SlopeInfo> findLatestSlopeInfo(int limit);

    @Select("SELECT slope_name FROM slope_info WHERE dept_id = #{deptId} ORDER BY update_time DESC LIMIT 1")
    String selectSlopeName(Long deptId);

    @Select("SELECT slope_code FROM slope_info WHERE slope_name = #{slopeName}")
    String selectSlopeCode(String slopeName);

    @Select("SELECT slope_code FROM slope_info WHERE dept_id = #{deptId} LIMIT 1")
    String sselectSlopeCode(Long deptId);

    @Select("SELECT slope_code FROM slope_info WHERE dept_id = #{deptId}")
    List<String> sselectSlopeCodes(Long deptId);

    @Select( "SELECT start_pile_no FROM slope_info WHERE slope_name = #{slopeName}")
    Double selectSlopeStart(String slopeName);

    @Select("SELECT end_pile_no FROM slope_info WHERE slope_name = #{slopeName}")
    Double selectSlopeEnd(String slopeName);

    @Select("SELECT tech_condition_level FROM slope_info WHERE slope_name = #{slopeName}")
    String selectLevel(String slopeName);

    @Select("SELECT update_time FROM slope_info WHERE slope_name = #{slopeName}")
    String selectWatchingDate(String slopeName);

    @Select("SELECT slope_code,slope_name, tech_condition_level, update_time FROM slope_info WHERE dept_id = #{deptId} ORDER BY update_time DESC LIMIT 1")
    clickDTO findMessageOne(Long deptId);

    @Select("SELECT slope_name FROM slope_info")
    String SelectProvince();
    @Select("SELECT count(*) FROM slope_info")
    Object selectYjxmzssss();

    @Select("SELECT region FROM slope_info WHERE dept_id = #{slopeName} LIMIT 1")
    String selectRemark(Long slopeName);

    



    //String SelectLevel(String username);
}
